package com.xiejr.api.interfaces.product;

import com.xiejr.api.dto.product.ItemsSpecDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author mobai
 * @since 2021/3/12 09:40
 */
@FeignClient(value = "product",path = "specs")
public interface ProductService {

    /**
     *  通过商品id和库存id获得库存信息
     * @param itemId 商品id
     * @param specId 库存id
     * @return 商品库存
     */
    @GetMapping("stockInfo")
    @ApiOperation("通过商品id和库存id获得库存信息")
    ItemsSpecDTO getByItemIdAndSpecId(@RequestParam("itemId") String itemId, @RequestParam("specId") String specId);


    @PutMapping("/specs/deductInventory")
    @ApiOperation("扣减库存")
    void deductInventory(@RequestParam("specId") String specId);


}
